// $Id$

import java.io.*;
import java.lang.reflect.Field;
import java.nio.*;
import java.nio.channels.*;

public class CopyFile
{
  static public void main(String args[]) throws Exception {

    FileInputStream fis = new FileInputStream("C:\\Users\\Administrator\\Desktop\\nio\\src\\writesomebytes.txt");
    FileChannel channel = fis.getChannel();
    MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
    while (true){
      byte[] bytes = new byte[1024];
      map.clear();
      int i = channel.read(map);
      if (i == -1) {
        break;
      }
      System.out.println(map.get(bytes));
      System.out.println(bytes.toString());

    }
  }
}
